﻿namespace lucere.io.concurrency
{
	public class NoLock : Lock
	{
		/// <summary>
		/// Attempts to obtain exclusive access and immediately return
		/// upon success or failure.
		/// </summary>
		/// <returns>true iff exclusive access is obtained</returns>
		public override bool Obtain()
		{
			return true;
		}

		/// <summary>
		/// Releases exclusive access.
		/// </summary>
		public override void Release()
		{
		}

		/// <summary>
		/// Returns true if the resource is currently locked.  Note that one must
		/// still call <see cref="ILock.Obtain()"/> before using the resource.
		/// </summary>
		/// <returns></returns>
		public override bool IsLocked()
		{
			return false;
		}
		public override string ToString()
		{
			return "NoLock";
		}
	}
}